<extend name="Public/base"/>

<!-- 子导航 -->
<block name="sidebar">
    <include file="sidemenu" />
</block>

<block name="body">
	<!-- 标题 -->
	<div class="main-title">
		<h2>
		授权列表
		</h2>
	</div>
             <div class="row">
                 <a type="button" href="{:U('addAuth')}" class="btn btn-default">新增</a>
             </div>

			<!-- 按钮工具栏 -->
			<div class="cf">
		    
				<!-- 数据表格 -->
			    <div class="data-table">
					<table>
			            <!-- 表头 -->
			            <thead>
			                <tr>
		                        <th>序号</th>
		                        <th>标识</th>
		                        <th>授权网址</th>
		                        <th>授权状态</th>	
		                        <th>操作</th>		                        
			                </tr>
			            </thead>

			            <!-- 列表 -->
			            <tbody>
			            <volist name="list" id="info">
			                    <tr>
		                            <td>{$i}</td>
		                            <td>{$info.remark}</td>
		                            <td>{$info.auth_url}</td>
		                            <td><eq name="info.status" value="1">已授权<else/>未授权</eq></td>
		                            <td><a href="{:U('editAuth',array('id'=>$info['id']))}">编辑</a></td>
			                    </tr>
			            </volist>        
			            </tbody>
			        </table>
				</div>
				<!-- 分页 -->
			    <div class="page">
			        {$page}
			    </div>
			</div>

</block>
<block name="script">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	$(".search-form").find(".drop-down").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
	},function(){
		$("#sub-sch-menu").addClass("hidden");
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});

    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });
</script>
</block>
